Using R as a calculator
Using R either on your laptop or above console, compute the following values and write the answer in the box.
- What is \((40 + 5) \times 3\)?
- What is \(\sqrt{2^4 - 7}\)?
- What is \(\dfrac{e^2 + 1}{2}\) to two decimal places?
- What is \(\log_2(9)\) to two decimal places?
Finding new functions
The following operations were not shown in the slides so you will need to find the relevant functions yourself. How would you find these? Once you find the relevant functions, compute the following values in R and enter the value in the corresponding box.
- What is \(10! = 10\times 9 \times 8 \times \cdots \times 2 \times 1\)? This operation is referred to as “factorial”.
- What is \(\cos\left(\frac{2}{3}\pi\right) + \sin(-\pi)\) to two decimal places?
- The \(\lfloor x \rfloor\) denotes the floor function (the largest integer such that it is smaller or equal to \(x\)) and \(\lceil x \rceil\) denotes the ceiling function (the smallest integer such that it is larger or equal to \(x\)). What is \(\lfloor \frac{1}{4} \pi \rfloor + \lceil \pi e \rceil\)?
Installing R packages
Which function installs an R package on CRAN?
Which function loads an R package into your system?
On your own laptop, install the following packages:
praise,readr,readxl,reprex,sessioninfo.What function is in the
praisepackage? Try running this function on your own laptop.